# -*- coding:utf-8 -*-

list_my = [0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 5]
# 方法1
set_new = set(list_my)
print(set_new)
print({i: list_my.count(i) for i in set_new})
# 方法2
dict_new = dict.fromkeys(list_my, 0)  # 转化为字典，同时达到去重的目的
print(dict_new)
for i in list_my:
    dict_new[i] += 1
print(dict_new)
# 方法3
from collections import Counter

dict_new = Counter(list_my)
print(dict(dict_new))
print(dict_new.most_common(2))  # 打印前2名
